﻿using Service.Core.Result;

namespace Service.Core.Interface
{
    /// <summary>
    ///     Service层返回的处理结果
    /// </summary>
    public interface IServiceResult
    {
        /// <summary>
        ///     获取Service处理结果码
        /// </summary>
        /// <returns></returns>
        object GetCode();

        /// <summary>
        ///     设置Service处理结果码
        /// </summary>
        /// <param name="lgCode"></param>
        void SetCode(object lgCode);

        /// <summary>
        ///     获取Service返回数据
        /// </summary>
        /// <returns></returns>
        object GetData();

        /// <summary>
        ///     设置Service返回数据
        /// </summary>
        /// <param name="lgData"></param>
        void SetData(object lgData);

        /// <summary>
        ///     设置Service处理结果文字信息
        /// </summary>
        /// <param name="msg"></param>
        void SetMsg(string msg);

        /// <summary>
        ///     返回Service处理结果文字信息
        /// </summary>
        /// <returns></returns>
        string GetMsg();

        /// <summary>
        ///     比对Service处理结果码
        /// True：一致 False：不一致
        /// </summary>
        /// <param name="targetResult">需要比对的结果码</param>
        /// <returns>True：一致 False：不一致</returns>
        bool BoolResult(ResultType targetResult);

    }

    public interface IServiceResult<TViewModel> : IServiceResult where TViewModel : class
    {
        /// <summary>
        ///     获取Service返回数据
        /// </summary>
        /// <returns></returns>
        new TViewModel GetData();

        /// <summary>
        ///     设置Service返回数据
        /// </summary>
        /// <param name="lgData"></param>
        void SetData(TViewModel lgData);
    }
}